﻿//-----------------------------------------------------------------------
// <copyright file="DialogControlClassPage.cs" company="Noboru Project">
//      Copyright (c) Noboru Project. All rights reserved.
//
//      This source code is subject to terms and conditions of the New BSD License (BSD).
//      A copy of the license can be found in the License.html file at the root of this 
//      distribution. If you can not locate the New BSD License (BSD), please send an 
//      email to noboru_adm@live.com.
//      By using this source code in any fashion, you are agreeing to be bound by
//      the terms of the New BSD License (BSD) for Noboru.
//
//      You must not remove this notice, or any other, from this software.
// </copyright>
//-----------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Noboru.Windows.Controls;

namespace Noboru.Demo
{
    public partial class DialogControlClassPage : UserControl
    {
        private DialogControl _dialogControl;

        public DialogControlClassPage()
        {
            this.InitializeComponent();
            this.toolStripLabelClose.IsEnabled = false;
        }

        private void toolStripLabelShow_Click(object sender, RoutedEventArgs e)
        {
            this._dialogControl = new DialogControl();
            this._dialogControl.Closing += new EventHandler<CancelEventArgs>(this.dialogControl_Closing);
            this._dialogControl.Closed += new EventHandler(this.dialogControl_Closed);

            this._dialogControl.Show();
            this.toolStripLabelClose.IsEnabled = true;
        }

        private void dialogControl_Closed(object sender, EventArgs e)
        {
            this.toolStripLabelClose.IsEnabled = false;
        }

        private void dialogControl_Closing(object sender, CancelEventArgs e)
        {
            ////e.Cancel = true;
        }

        private void toolStripLabelShowModal_Click(object sender, RoutedEventArgs e)
        {
            this._dialogControl = new DialogControl();

            this._dialogControl.ShowModal();
            this._dialogControl.Closing += new EventHandler<CancelEventArgs>(this.dialogControl_Closing);
            this._dialogControl.Closed += new EventHandler(this.dialogControl_Closed);
            this.toolStripLabelClose.IsEnabled = true;
        }

        private void toolStripLabelShowModalGray_Click(object sender, RoutedEventArgs e)
        {
            this._dialogControl = new DialogControl();

            this._dialogControl.ShowModal(true);
            this._dialogControl.Closing += new EventHandler<CancelEventArgs>(this.dialogControl_Closing);
            this._dialogControl.Closed += new EventHandler(this.dialogControl_Closed);
            this.toolStripLabelClose.IsEnabled = true;
        }

        private void toolStripLabelClose_Click(object sender, RoutedEventArgs e)
        {
            this._dialogControl.Close();
        }
    }
}
